using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerHurtBackState : PlayerGlobalState
{
    public PlayerHurtBackState(Player player, PlayerMoveData playerData, StateMachine stateMachine, string animName) : base(player, playerData, stateMachine, animName)
    {
    }

    private float hurtValue;

    public void SetHurtValue(float hurtValue) { this.hurtValue = hurtValue; }

    public override void LogicUpdate()
    {
        base.LogicUpdate();

        player.SetVelocityX(hurtValue);

        if (isAnimationFinish)
        {
            if (player.Health.IsDead)
            {
                stateMachine.ChangeState(player.DeadState);
            }
            else 
            {
                stateMachine.ChangeState(player.IdleState);
            }
        }
    }
}
